import java.util.HashMap;
import java.util.Map;

/**
 * Associates the specified value with the specified key in this map.
 * If the map previously contained a mapping for the key, the old
 * value is replaced.
 *
 * @param key key with which the specified value is to be associated
 * @param value value to be associated with the specified key
 * @return the previous value associated with <tt>key</tt>, or
 *         <tt>null</tt> if there was no mapping for <tt>key</tt>.
 *         (A <tt>null</tt> return can also indicate that the map
 *         previously associated <tt>null</tt> with <tt>key</tt>.)
 */
// Map put method doc

public class MapTest {
	public static void main(String[] args) {
		Map map = new HashMap();
		map.put("username", "tao");

		map.put("username", "taoge");

		System.out.println(map.size()); // 1
		// put已存在的主键时，值被覆盖
		System.out.println(map.get("username")); // taoge
	}
}